<?php
/*************************************************************************************
 *
 *	FileName: header_php.php
 *	Desc    : show all the pictures the user uploaded along with the review
 *	Author  : Seal
 *	Date    : 2010-1-23
 *
 *************************************************************************************/
	
	$logid=GetLoginUserID();
	if(isset($_GET['uid'])&&intval($_GET['uid'])>0)
	{
		$uid=intval($_GET['uid']);
	}
	else
	{
		if($logid!=false)
			$uid=$logid;
		else
			edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
	}
	
	$userDAO=GetUserDAO();
	$user=$userDAO->GetUserNameByID($uid);
	
	if(!$user)
		edp_redirect(edp_href_link(PAGENAME_PAGE_NOT_FOUND));
	
	$sid=0;
	if(isset($_GET['sid'])&& is_numeric($_GET['sid']))
		$sid=intval($_GET['sid']);
		
	require_once 'lib/classes/Pager.php';
	
	if( isset($_GET['p']) && is_numeric($_GET['p']) )
		$startPos = intval($_GET['p']);
	else
		$startPos = 1;
	
	$currentURL = htmlspecialchars( $_SERVER["REQUEST_URI"] );
	$currentURL = preg_replace( '/&p=[0-9]+/', "", $currentURL );
		
	//$picCount = $userDAO->GetPicCount( $uid );
	/*
	if( $sid == 0 )
		$picCountBySid = $userDAO->GetPicCount( $uid );
	else
		$picCountBySid = $userDAO->GetPictureCountBysid( $uid, $sid );
	*/
	$picCountBySid = $userDAO->GetPictureCountBysid( $uid, $sid );
		
	$pics = $userDAO->GetPicturesBysid( $uid, $sid, $startPos );
	
	$reviewDAO=GetReviewDAO();
	$picCate=$reviewDAO->GetPictureShopByUid($uid);
	
	$page= new Pager( $currentURL, $picCountBySid, PIC_PER_PAGE, $startPos, UP_RESULT_PAGE );
?>
